package demo19;

import java.io.*;

public class demo19_3 {
    public static void main(String[] args) throws Exception {
        try (InputStream is = new FileInputStream("src\\main\\java\\demo19\\a.txt");
             InputStream dis = new BufferedInputStream(is);
             OutputStream os = new FileOutputStream("src\\main\\java\\demo19\\b.txt");
             OutputStream dos = new BufferedOutputStream(os);)
        {
            byte[] buffer = new byte[1024];
            int len;
            while((len = dis.read(buffer)) != -1){
                dos.write(buffer, 0, len);
            }
            System.out.println("复制完毕");
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } finally {

        }
    }
}
